package org.dinner.order.service.impl;

import java.util.Date;
import java.util.List;

import org.dinner.order.dao.OrderDAO;
import org.dinner.order.model.Order;
import org.dinner.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderDAO orderDAO;
	
	@Transactional
	public Order add(Order item) {
		return orderDAO.add(item);
	}

	@Transactional
	public List<Order> list() {
		return orderDAO.list();
	}

	@Transactional
	public Order getById(int id) {
		return orderDAO.getById(id);
	}

	@Transactional
	public void remove(int id) {
		orderDAO.remove(id);
	}
	
	@Transactional
	public Order getByShippmentDate(int suId, Date date) {
		return orderDAO.getByShippmentDate(suId, date);
	}

	@Transactional
	public Order getByMenuId(int suId, int menuId) {
		return orderDAO.getByMenuId(suId, menuId);
	}

	@Transactional
	public void addOrderItem(int orderId, int itemId) {
		orderDAO.addOrderItem(orderId, itemId);
	}

}
